# forms.py
from django import forms
from .models import Book  # 导入你的Book模型


class BookForm(forms.ModelForm):
    # 自定义日期字段，使用HTML5日期选择器
    publication_date = forms.DateField(
        widget=forms.DateInput(attrs={'type': 'date'}),
        label="出版日期"
    )

    class Meta:
        model = Book
        fields = ['title', 'author', 'publication_date', 'description']
